<?php
class ModelDelimanGhichu extends Model 
{
	public function getList($where = "")
	{
		$query = $this->db->query("Select `dlm_ghichu`.* where ".$where);
		return $query->rows;
	}
	
	public function getItem($hanhdongid)
	{
		$query = $this->db->query("Select * from `dlm_ghichu` where id = '".$id."'");
		return $query->row;
	}
		
	public function insert($data)
	{
		$id=$this->db->escape(@$data['id']);
		$nhanvienid=$this->db->escape(@$data['nhanvienid']);
		$tennhanvien=$this->db->escape(@$data['tennhanvien']);
		$khachhangid=$this->db->escape(@$data['khachhangid']);
		$tenkhachhang=$this->db->escape(@$data['tenkhachhang']);
		$noidung=$this->db->escape(@$data['noidung']);
		$ngayghichu=$this->db->escape(@$data['ngayghichu']);
				
		$field=array(
						'id',
						'nhanvienid',
						'tennhanvien',
						'khachhangid',
						'tenkhachhang',
						'noidung',
						'ngayghichu'
					);
		$value=array(
						$id,
						$nhanvienid,
						$tennhanvien,
						$khachhangid,
						$tenkhachhang,
						$noidung,
						$ngayghichu
					);
		return $this->db->insertData("dlm_ghichu",$field,$value);
	}
	
	public function update($data)
	{
		$id=$this->db->escape(@$data['id']);
		$nhanvienid=$this->db->escape(@$data['nhanvienid']);
		$tennhanvien=$this->db->escape(@$data['tennhanvien']);
		$khachhangid=$this->db->escape(@$data['khachhangid']);
		$tenkhachhang=$this->db->escape(@$data['tenkhachhang']);
		$noidung=$this->db->escape(@$data['noidung']);
		$ngayghichu=$this->db->escape(@$data['ngayghichu']);
				
		$field=array(
						'id',
						'nhanvienid',
						'tennhanvien',
						'khachhangid',
						'tenkhachhang',
						'noidung',
						'ngayghichu'
					);
		$value=array(
						$id,
						$nhanvienid,
						$tennhanvien,
						$khachhangid,
						$tenkhachhang,
						$noidung,
						$ngayghichu
					);
					
		$where="id = '".$id."'";
		$this->db->updateData("dlm_ghichu",$field,$value,$where);
	}	
			
	public function delete($id)
	{
		$id=$this->db->escape(@$id);
		$where="id = '".$id."'";
		$this->db->deleteData('dlm_ghichu',$where);
	}
	
	public function deletes($data)
	{
		foreach($data as $id)
		{
			$this->delete($id);
		}		
	}	
}

?>